#include "Quadratic.h"

Quadratic::Quadratic(float h, float k, float a): m_h(h) , m_k(k) , m_a(a)
{
    //ctor
}
Quadratic::~Quadratic()
{
    //dtor
}
Quadratic::Quadratic(float h, float k, float x, float y)
{
    m_h = h;
    m_k = k;
    m_a = y/k * 1/Ogre::Math::Sqr(x-h);
}
float Quadratic::operator()(float x)
{
    return m_a * Ogre::Math::Sqr(x-m_h) + m_k;
}
std::pair<float,float> Quadratic::GetX(float y)
{
    std::pair<float,float> x;
    x.first = - Ogre::Math::Sqrt((y - m_k)/m_a) + m_h;
    x.second = Ogre::Math::Sqrt((y - m_k)/m_a) + m_h;
    return x;
}
